//
//  CustomerTabBarButton.m
//  miaopai
//
//  Created by Crow Zhang on 15/11/13.
//  Copyright © 2015年 Crow Zhang. All rights reserved.
//

#import "CustomerTabBarButton.h"

@implementation CustomerTabBarButton

- (void)dealloc
{
    [_textLabel release];
    [_image release];
    [_target release];
    [super dealloc];
}

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor clearColor];
        
        self.image = [[UIImageView alloc] initWithFrame:CGRectMake(frame.size.width / 2 - 14, 5, 28, 28)];
        self.image.userInteractionEnabled = YES;
        [self addSubview:self.image];
        
        self.textLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 33, frame.size.width, 10)];
        self.textLabel.font = [UIFont systemFontOfSize:9];
        self.textLabel.textColor = [UIColor colorWithRed:0.663 green:0.718 blue:0.718 alpha:1.000];
        self.textLabel.textAlignment = NSTextAlignmentCenter;
        self.image.userInteractionEnabled = YES;
        [self addSubview:self.textLabel];
        
        [_image release];
        [_textLabel release];
    }
    return self;
}

- (void)addMyTarget:(id)target action:(SEL)action
{
    self.target = target;
    self.action = action;
}

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    [self.target performSelector:self.action withObject:self];
}



// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
    
}


@end
